#pragma once

#include "DLL.h"

namespace My {

///modeless dialog informing about progress of something (typically it's rendering progress)
class DLL_API ProgressDlg : public CDialog
{
public:
	ProgressDlg(); ///< deferred window creation
	ProgressDlg(CWnd * Parent, bool DisableParent = false);
	~ProgressDlg();
	void Create(CWnd * Parent = 0, bool DisableParent = false);
	void Reset(unsigned Max, unsigned Current = 0); ///< sets counter to '0/Max' and shows window
	unsigned Current() const { return m_Curr; }
	void SetCurrent(unsigned Val);
	///return cancel status of dialog: false means that user pressed 'Cancel' or cross buttons
	bool Increment();
	bool Canceled() const
		{ return m_Canceled; }
protected:
	DECLARE_MESSAGE_MAP()
	void OnCancel();
private:
	CProgressCtrl *	ProgressCtrl();
	void UpdateControls();
private:
	bool m_DisableParent;
	unsigned m_Curr, m_Max;
	bool m_Canceled;
};

} //namespace My
